<template>
	<view class="content">
		<view class="image" v-for="(item,index) in image" :key="index">
			<image style="width: 150rpx;height: 150rpx;" @click="editImage(item)" :src="'https://yueshibaohe.com/'+item"></image>
		</view>
	</view>
</template>

<script>
	import { userEdit } from '../../../api/user';
	import {
		mapGetters
	} from "vuex";
	export default {
		computed: mapGetters(['userInfo']),
		data() {
			return {
				image:[
					"crmebimage/public/maintain/2025/01/07/66d4fcec69014b49ba23769414910afbv7aqxdhktr.jpg",
					"crmebimage/public/maintain/2025/01/07/41c7e26ec3bc40fe9c50df02dfacc022u5qwo6rq03.jpg",
					"crmebimage/public/maintain/2025/01/07/79a331391b154a07bd88fa580ba092902mf3zbpidc.jpg",
					"crmebimage/public/maintain/2025/01/07/6dd6c73f28ad4885a7b214448e11d1dfecti1u5rwe.jpg",
					"crmebimage/public/maintain/2025/01/07/c44de3da686c4aeb9249ca07843ec1dfs5xfs9vhu6.jpg",
					"crmebimage/public/maintain/2025/01/07/eed5d3ee7d114e64a83622de15016f9dqhguw8t9u6.jpg",
					"crmebimage/public/maintain/2025/01/07/37f9f3a35130409ea88a422c04034b78v42zbxotbk.jpg",
					"crmebimage/public/maintain/2025/01/07/da04021c43ad4274b422c8942f1606e8450m80vjxk.jpg",
					"crmebimage/public/maintain/2025/01/07/63a4b4fb2c804c568d2506df94ad18e5krrq8i7nq1.jpg",
					"crmebimage/public/maintain/2025/01/07/2acdb835ae5c4ac58e0de13f72f23b9c2g2vmvn6dn.jpg",
					"crmebimage/public/maintain/2025/01/07/d2ac642433ce48f7afcb2d8fffe6fc88q9qkglp9p1.jpg",
					"crmebimage/public/maintain/2025/01/07/df572b12f74d48a2b6eeed31608efc11xny6539iyr.jpg",
					"crmebimage/public/maintain/2025/01/07/8b988d627670469f9a513dba45aa6656mx1ec00uih.jpg",
					"crmebimage/public/maintain/2025/01/07/12ef778f6e7d4cf5a98641558434a33bopy0n1njdb.jpg",
					"crmebimage/public/maintain/2025/01/07/fd7e83e593aa41688137de044ecfb2bc42lhhztxa7.jpg",
					"crmebimage/public/maintain/2025/01/07/0e7213eb7fed4588b7a3c5d1906a0c2a5b6g9ilhyu.jpg",
					"crmebimage/public/maintain/2025/01/07/e44338d71067417caa0ec226706a2614evihxhp8se.jpg",
					"crmebimage/public/maintain/2025/01/07/4cdb60b7750a4154a00c5fd49d82df6c9t8gnhah72.jpg",
					"crmebimage/public/maintain/2025/01/07/183fb362a3b646ee959262ed3d5ef2f9vzfnjtd2xg.jpg",
					"crmebimage/public/maintain/2025/01/07/2bdefaaf341d4ead8e82d352cd5153fdk4158cmrxx.jpg",
					"crmebimage/public/maintain/2025/01/07/efd0b4b8b4034b7d9a31b3b0da0e5ca1rr2rt5h729.jpg",
					"crmebimage/public/maintain/2025/01/07/dfa66b16476540379d0f7db79271ab9aob5us1vmdo.jpg",
				]
			}
		},
		methods: {
			editImage(url){
				let res1 = this.userInfo
				this.$store.commit('UPDATE_USERINFO',{...res1,avatar:url})
				userEdit({...res1,avatar:url}).then(res=>{
					this.$util.Tips({
						title: '修改成功'
					});
					setTimeout(()=>{
						uni.switchTab({
							url:"/pages/tabBar/user"
						})
					},800)
				})
			},
		}
	}
</script>

<style>
.content{
	display: grid;
	grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
}
</style>
